<?php
namespace app\api\controller;
use think\Controller;
class City extends Controller
{
    private  $obj;
    public function _initialize() {
        $this->obj = model("City");
    }
    public function getCitysByParentId() {
        $id = intval(input('post.id')); 
        if(!$id) {
            $this->error('ID不合法');
        }
        //halt($id);
        // 通过id获取二级城市
        $citys = $this->obj->getNormalCitysByParentId($id);
        if(!$citys) {
            return show(0,'error');
        }
       
        //调用common 内show方法
        return show(1,'success', $citys);
    }
}
